//
//  LTThridKeyCfgManger.m
//  LTChat
//
//  Created by 俊松何 on 2017/8/22.
//  Copyright © 2017年 俊松何. All rights reserved.
//

#import "LTThridKeyCfgManger.h"
#import <UMShare/UMShare.h>
#import <UMCommon/UMCommon.h>
#import <AMapFoundationKit/AMapFoundationKit.h>
#import <JPush/JPUSHService.h>
static LTThridKeyCfgManger *manager = nil;
@implementation LTThridKeyCfgManger

+(instancetype)manager
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manager = [[LTThridKeyCfgManger alloc] init];
        [manager setup];
        manager.isReview = YES;
    });
    return manager;
}

-(void)setup
{
        _mapKey = @"2ebd0ba8d66da1d2293b9b4c63d568d6";
        _marsAppId = @"10";
        _versionType = VersionCherryChat;
}

-(void)InitializeAllSDK
{
    [self confitUShareSettings];
    [self configUSharePlatforms];
}

-(void)getVersionInfoWithCompletion:(void (^)(UpdateModel *model,MTError *error))completionBlock;
{
    
    [[MTHttpTool shareTool] getPath:@"/commons/app/update" parameters:nil success:^(MTBaseData *datamodel) {
        UpdateModel *model = [UpdateModel mj_objectWithKeyValues:datamodel.data];
        self.appinfo = model;
        completionBlock(model,nil);
    }  failer:^(MTError *error) {
         completionBlock(nil,error);
    }];
}


- (void)confitUShareSettings
{
    /*
     * 打开图片水印
     */
    [[UMSocialManager defaultManager]setUmSocialAppkey:@"5b5fbec38f4a9d697f0000b3"];
    
    [UMSocialGlobal shareInstance].isUsingWaterMark = YES;
    [UMSocialGlobal shareInstance].isUsingHttpsWhenShareContent = NO;
//    [UMSoc]
}


- (void)configUSharePlatforms
{
    /* 设置微信的appKey和appSecret */
    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:@"wxf646a10fa62d4b10" appSecret:@"e44e9f4446f79d51502cbbe42ef53db5" redirectURL:@"http://mobile.umeng.com/social"];
    /*
     * 移除相应平台的分享，如微信收藏
     */
    //[[UMSocialManager defaultManager] removePlatformProviderWithPlatformTypes:@[@(UMSocialPlatformType_WechatFavorite)]];
    /* 设置分享到QQ互联的appID
     * U-Share SDK为了兼容大部分平台命名，统一用appKey和appSecret进行参数设置，而QQ平台仅需将appID作为U-Share的appKey参数传进即可。
     */
    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_QQ appKey:@"1107462304"/*设置QQ平台的appID*/  appSecret:nil redirectURL:@"http://mobile.umeng.com/social"];
   
    
}


@end
